﻿using RTW.Core.Ioc;
using RTW.Core.Repository;
using RTW.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;


namespace RTW.Servers
{
    public class HomeMenuServer: BaseServers<SysHomeMenu>, IAutoInject
    {
        private readonly IRepositoryAsync<SysHomeMenu> SysHomeMenu;

        public HomeMenuServer()
        {
            SysHomeMenu = new DapperAsyncRepository<SysHomeMenu>();
        }

        /// <summary>
        /// 获取集合数据
        /// </summary>
        /// <returns></returns>
        public async Task<List<SysHomeMenu>> GetHomeMenuList()
        {
            return (await SysHomeMenu.GetAllEnumerableAsync()).ToList();
        }
        /// <summary>
        /// 根据HMSX排序
        /// </summary>
        /// <returns></returns>
        public async Task<List<SysHomeMenu>> GetOrderHomeMenuList()
        {
            return (await SysHomeMenu.SqlWithParams("select * from Sys_HomeMenu order by HMSX")).ToList();
        }

    }
}
